home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / news / inn1.000 / inn1.4sec-linux-src.tar / inn / frontends / innconfval.c < prev    next >
C/C++ Source or Header  |  1992-07-24  |  907b  |  50 lines

  1. /*  $Revision: 1.3 $
  2. **
  3. **  Get a config value from INN.
  4. */
  5. #include "configdata.h"
  6. #include <stdio.h>
  7. #include <sys/types.h>
  8. #include "libinn.h"
  9. #include "clibrary.h"
  10. #include "macros.h"
  11.  
  12.  
  13. int
  14. main(ac, av)
  15.     int            ac;
  16.     char        *av[];
  17. {
  18.     register char    *p;
  19.     register char    *val;
  20.     register BOOL    File;
  21.     register int    i;
  22.  
  23.     /* Parse JCL. */
  24.     File = FALSE;
  25.     while ((i = getopt(ac, av, "f")) != EOF)
  26.     switch (i) {
  27.     default:
  28.         (void)fprintf(stderr, "Usage error.\n");
  29.         exit(1);
  30.         /* NOTREACHED */
  31.     case 'f':
  32.         File = TRUE;
  33.         break;
  34.     }
  35.     ac -= optind;
  36.     av += optind;
  37.  
  38.     /* Loop over parameters, each a config value. */
  39.     while ((p = *av++) != NULL) {
  40.     val = File ? GetFileConfigValue(p) : GetConfigValue(p);
  41.     if (val == NULL)
  42.         (void)fprintf(stderr, "No value for %s parameter\n", p);
  43.     else
  44.         (void)printf("%s\n", val);
  45.     }
  46.  
  47.     exit(0);
  48.     /* NOTREACHED */
  49. }
  50.